import pandas as pd
import plotly.express as px
vn_index = pd.read_csv('C:/Users/DUC/Documents/Data/Index/VN Historical Data Weekly.csv')
nifty_50_index = pd.read_csv('C:/Users/DUC/Documents/Data/Index/Nifty 50 Historical Data Weekly.csv')
chile_index = pd.read_csv('C:/Users/DUC/Documents/Data/Index/Chile S&P CLX IPSA Historical Data Weekly.csv')
shanghai_index = pd.read_csv('C:/Users/DUC/Documents/Data/Index/Shanghai Composite Historical Data Weekly.csv')
dhaka_index = pd.read_csv('C:/Users/DUC/Documents/Data/Index/Dhaka Stock Exchange Broad Historical Data Weekly.csv')
vn_index['Label'] = ['VN_INDEX'] * len(vn_index)
vn_index = vn_index.iloc[::-1,:].reset_index()
nifty_50_index['Label'] = ['NIFTY_50'] * len(nifty_50_index)
nifty_50_index = nifty_50_index.iloc[::-1,:]
chile_index['Label'] = ['CHILE_INDEX'] * len(chile_index)
chile_index = chile_index.iloc[::-1,:]
shanghai_index['Label'] = ['SHANGHAI_COMPOSITE'] * len(shanghai_index)
shanghai_index = shanghai_index.iloc[::-1,:].reset_index()
dhaka_index['Label'] = ['DHAKA_INDEX'] * len(dhaka_index)
dhaka_index = dhaka_index.iloc[::-1,:]
df = pd.concat([chile_index,shanghai_index,vn_index,nifty_50_index,dhaka_index], axis =0)
df.describe()
df
fig_line = px.line(df, x='Date', y='Price', color='Label')
fig_line.show()
gdp_worldbank = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/GDP_by_country_Data_WorldBank.csv')
gdp_worldbank = gdp_worldbank.T
columns = gdp_worldbank[0:1][:].values
gdp_worldbank.columns = columns[0]
gdp_worldbank = gdp_worldbank[1:]
index = [i for i in range(0,30)]
gdp_worldbank.head()
years = [i for i in range(1990,2019)]
vietnam_gdp = pd.DataFrame({'years' : years, 'gdp' : gdp_worldbank['Vietnam'].values, 'label' : ['VietNam'] * 29})
china_gdp = pd.DataFrame({'years' : years,'gdp' : gdp_worldbank['China'].values, 'label' : ['China'] * 29})
india_gdp = pd.DataFrame({'years' : years,'gdp' : gdp_worldbank['India'].values, 'label' : ['India'] * 29})
chile_gdp = pd.DataFrame({'years' : years,'gdp' : gdp_worldbank['Chile'].values, 'label' : ['Chile'] * 29})
bangladesh_gdp = pd.DataFrame({'years' : years,'gdp' : gdp_worldbank['Bangladesh'].values, 'label' : ['Bangladesh'] * 29})
new_world_gdp_with_label = pd.concat([vietnam_gdp, china_gdp, india_gdp, chile_gdp, bangladesh_gdp], axis =0)
new_world_gdp_with_label.tail()
fig_line = px.line(new_world_gdp_with_label, x='years', y='gdp', color='label')
fig_line.show()
net_oda_per_capita = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/Net_ODA_per_capita.csv')
net_oda_per_capita = net_oda_per_capita.T
columns = net_oda_per_capita[0:1][:].values
net_oda_per_capita.columns = columns[0]
net_oda_per_capita = net_oda_per_capita[1:]
index = [i for i in range(0,30)]
net_oda_per_capita.head()
years = [i for i in range(1990,2019)]
vietnam_net_oda_per_capita = pd.DataFrame({'years' : years, 'net_oda_per_capita' : net_oda_per_capita['Vietnam'].values, 'label' : ['VietNam'] * 29})
china_net_oda_per_capita = pd.DataFrame({'years' : years,'net_oda_per_capita' : net_oda_per_capita['China'].values, 'label' : ['China'] * 29})
india_net_oda_per_capita = pd.DataFrame({'years' : years,'net_oda_per_capita' : net_oda_per_capita['India'].values, 'label' : ['India'] * 29})
chile_net_oda_per_capita = pd.DataFrame({'years' : years,'net_oda_per_capita' : net_oda_per_capita['Chile'].values, 'label' : ['Chile'] * 29})
bangladesh_net_oda_per_capita = pd.DataFrame({'years' : years,'net_oda_per_capita' : net_oda_per_capita['Bangladesh'].values, 'label' : ['Bangladesh'] * 29})
new_net_oda_per_capita = pd.concat([vietnam_net_oda_per_capita, china_net_oda_per_capita, india_net_oda_per_capita, chile_net_oda_per_capita, bangladesh_net_oda_per_capita])
new_net_oda_per_capita.head()
fig_line = px.line(new_net_oda_per_capita, x = 'years', y = 'net_oda_per_capita', color = 'label')
fig_line.show()
enegy_used_per_capita = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/Enegy_used_per_capita.csv')
enegy_used_per_capita = enegy_used_per_capita.T
columns = enegy_used_per_capita[0:1][:].values
enegy_used_per_capita.columns = columns[0]
enegy_used_per_capita = enegy_used_per_capita[1:]
index = [i for i in range(0,30)]
enegy_used_per_capita.head()
years = [i for i in range(1990,2020)]
num_of_years = 30
vietnam_enegy_used_per_capita = pd.DataFrame({'years' : years, 'enegy_used_per_capita' : enegy_used_per_capita['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_enegy_used_per_capita = pd.DataFrame({'years' : years,'enegy_used_per_capita' : enegy_used_per_capita['China'].values, 'label' : ['China'] * num_of_years})
india_enegy_used_per_capita = pd.DataFrame({'years' : years,'enegy_used_per_capita' : enegy_used_per_capita['India'].values, 'label' : ['India'] * num_of_years})
chile_enegy_used_per_capita = pd.DataFrame({'years' : years,'enegy_used_per_capita' : enegy_used_per_capita['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_enegy_used_per_capita = pd.DataFrame({'years' : years,'enegy_used_per_capita' : enegy_used_per_capita['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_enegy_used_per_capita = pd.concat([vietnam_enegy_used_per_capita,china_enegy_used_per_capita,india_enegy_used_per_capita,chile_enegy_used_per_capita,bangladesh_enegy_used_per_capita])
new_enegy_used_per_capita.head()
fig_line = px.line(new_enegy_used_per_capita, x = 'years', y = 'enegy_used_per_capita', color = 'label')
fig_line.show()
world_stock_marketcap = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/WorldStockMarketCap.csv')
world_stock_marketcap = world_stock_marketcap.T
columns = world_stock_marketcap[0:1][:].values
world_stock_marketcap.columns = columns[0]
world_stock_marketcap = world_stock_marketcap[1:]
world_stock_marketcap.head()
years = [i for i in range(1990,2020)]
num_of_years = 30
vietnam_stock_marketcap = pd.DataFrame({'years' : years, 'stock_marketcap' : world_stock_marketcap['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_stock_marketcap = pd.DataFrame({'years' : years,'stock_marketcap' : world_stock_marketcap['China'].values, 'label' : ['China'] * num_of_years})
india_stock_marketcap = pd.DataFrame({'years' : years,'stock_marketcap' : world_stock_marketcap['India'].values, 'label' : ['India'] * num_of_years})
chile_stock_marketcap = pd.DataFrame({'years' : years,'stock_marketcap' : world_stock_marketcap['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_stock_marketcap = pd.DataFrame({'years' : years,'stock_marketcap' : world_stock_marketcap['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_world_stock_marketcap = pd.concat([vietnam_stock_marketcap,china_stock_marketcap,india_stock_marketcap,chile_stock_marketcap,bangladesh_stock_marketcap])
import plotly.express as px
fig_line = px.line(new_world_stock_marketcap, x = 'years', y = 'stock_marketcap', color = 'label')
fig_line.show()
fig_line = px.line(new_world_gdp_with_label, x='years', y='gdp', color='label')
fig_line.show()
world_inflation = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/Inflation.csv')
world_inflation = world_inflation.T
columns = world_inflation[0:1][:].values
world_inflation.columns = columns[0]
world_inflation = world_inflation[1:]
world_inflation.head()
years = [i for i in range(1990,2020)]
num_of_years = 30
vietnam_inflation = pd.DataFrame({'years' : years, 'inflation' : world_inflation['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_inflation = pd.DataFrame({'years' : years,'inflation' : world_inflation['China'].values, 'label' : ['China'] * num_of_years})
india_inflation = pd.DataFrame({'years' : years,'inflation' : world_inflation['India'].values, 'label' : ['India'] * num_of_years})
chile_inflation = pd.DataFrame({'years' : years,'inflation' : world_inflation['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_inflation = pd.DataFrame({'years' : years,'inflation' : world_inflation['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_world_inflation = pd.concat([vietnam_inflation,china_inflation,india_inflation,chile_inflation,bangladesh_inflation])
fig_line = px.line(new_world_inflation, x='years', y='inflation', color='label')
fig_line.show()
world_population = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/WorldPopulation.csv')
world_population = world_population.T
columns = world_population[0:1][:].values
world_population.columns = columns[0]
world_population = world_population[1:]
world_population.head()
years = [i for i in range(1990,2020)]
num_of_years = 30
vietnam_population = pd.DataFrame({'years' : years, 'population' : world_population['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_population = pd.DataFrame({'years' : years,'population' : world_population['China'].values, 'label' : ['China'] * num_of_years})
india_population = pd.DataFrame({'years' : years,'population' : world_population['India'].values, 'label' : ['India'] * num_of_years})
chile_population = pd.DataFrame({'years' : years,'population' : world_population['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_population = pd.DataFrame({'years' : years,'population' : world_population['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_world_population = pd.concat([vietnam_population,china_population,india_population,chile_population,bangladesh_population])
fig_line = px.line(new_world_population, x='years', y='population', color='label')
fig_line.show()
world_co2_emission = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/CO2Emission.csv')
world_co2_emission = world_co2_emission.T
columns = world_co2_emission[0:1][:].values
world_co2_emission.columns = columns[0]
world_co2_emission = world_co2_emission[1:]
world_co2_emission.head()
years = [i for i in range(1990,2016)]
num_of_years = 26
vietnam_co2_emission = pd.DataFrame({'years' : years, 'co2 emission' : world_co2_emission['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_co2_emission = pd.DataFrame({'years' : years,'co2 emission' : world_co2_emission['China'].values, 'label' : ['China'] * num_of_years})
india_co2_emission = pd.DataFrame({'years' : years,'co2 emission' : world_co2_emission['India'].values, 'label' : ['India'] * num_of_years})
chile_co2_emission = pd.DataFrame({'years' : years,'co2 emission' : world_co2_emission['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_co2_emission = pd.DataFrame({'years' : years,'co2 emission' : world_co2_emission['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_world_co2_emission = pd.concat([vietnam_co2_emission,china_co2_emission,india_co2_emission,chile_co2_emission,bangladesh_co2_emission])
fig_line = px.line(new_world_co2_emission, x='years', y='co2 emission', color='label')
fig_line.show()
new_world_co2_emission_2014 = new_world_co2_emission[new_world_co2_emission['years'] == 2014]
fig_bar = px.bar(new_world_co2_emission_2014, x = 'label', y='co2 emission', color = 'label')
fig_bar.show()
new_world_co2_emission_1900 = new_world_co2_emission[new_world_co2_emission['years'] == 1990]
new_world_co2_emission_1900
fig_bar = px.bar(new_world_co2_emission_1900, x = 'label', y='co2 emission', color='label')
fig_bar.show()
world_poverty_headcount_ratio = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/Poverty headcount ratio.csv')
world_poverty_headcount_ratio = world_poverty_headcount_ratio.T
columns = world_poverty_headcount_ratio[0:1][:].values
world_poverty_headcount_ratio.columns = columns[0]
world_poverty_headcount_ratio = world_poverty_headcount_ratio[1:]
world_poverty_headcount_ratio.head()
years = [i for i in range(1990,2019)]
num_of_years = 29
vietnam_co2_poverty_headcount_ratio = pd.DataFrame({'years' : years, 'poverty_headcount_ratio' : world_poverty_headcount_ratio['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_co2_poverty_headcount_ratio = pd.DataFrame({'years' : years,'poverty_headcount_ratio' : world_poverty_headcount_ratio['China'].values, 'label' : ['China'] * num_of_years})
india_co2_poverty_headcount_ratio = pd.DataFrame({'years' : years,'poverty_headcount_ratio' : world_poverty_headcount_ratio['India'].values, 'label' : ['India'] * num_of_years})
chile_co2_poverty_headcount_ratio = pd.DataFrame({'years' : years,'poverty_headcount_ratio' : world_poverty_headcount_ratio['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_co2_poverty_headcount_ratio = pd.DataFrame({'years' : years,'poverty_headcount_ratio' : world_poverty_headcount_ratio['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_world_poverty_headcount_ratio = pd.concat([vietnam_co2_poverty_headcount_ratio,china_co2_poverty_headcount_ratio,india_co2_poverty_headcount_ratio,chile_co2_poverty_headcount_ratio,bangladesh_co2_poverty_headcount_ratio])
fig_line = px.line(new_world_poverty_headcount_ratio, x='years', y='poverty_headcount_ratio', color='label')
fig_line.show()
world_industry_value_added = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/Industry value added.csv')
world_industry_value_added = world_industry_value_added.T
columns = world_industry_value_added[0:1][:].values
world_industry_value_added.columns = columns[0]
world_industry_value_added = world_industry_value_added[1:]
world_industry_value_added.head()
years = [i for i in range(1990,2020)]
num_of_years = 30
vietnam_industry_value_added = pd.DataFrame({'years' : years, 'industry_value_added' : world_industry_value_added['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_industry_value_added = pd.DataFrame({'years' : years,'industry_value_added' : world_industry_value_added['China'].values, 'label' : ['China'] * num_of_years})
india_industry_value_added = pd.DataFrame({'years' : years,'industry_value_added' : world_industry_value_added['India'].values, 'label' : ['India'] * num_of_years})
chile_industry_value_added = pd.DataFrame({'years' : years,'industry_value_added' : world_industry_value_added['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_industry_value_added = pd.DataFrame({'years' : years,'industry_value_added' : world_industry_value_added['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_world_industry_value_added = pd.concat([vietnam_industry_value_added,china_industry_value_added,india_industry_value_added,chile_industry_value_added,bangladesh_industry_value_added])
fig_line = px.line(new_world_industry_value_added, x='years', y='industry_value_added', color='label')
fig_line.show()
fig_line = px.line(new_world_stock_marketcap, x = 'years', y = 'stock_marketcap', color = 'label')
fig_line.show()
world_external_debt_stock = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/External debt stocks.csv')
world_external_debt_stock = world_external_debt_stock.T
columns = world_external_debt_stock[0:1][:].values
world_external_debt_stock.columns = columns[0]
world_external_debt_stock = world_external_debt_stock[1:]
world_external_debt_stock.head()
years = [i for i in range(1990,2020)]
num_of_years = 30
vietnam_external_debt_stock= pd.DataFrame({'years' : years, 'external_debt_stock' : world_external_debt_stock['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_external_debt_stock = pd.DataFrame({'years' : years,'external_debt_stock' : world_external_debt_stock['China'].values, 'label' : ['China'] * num_of_years})
india_external_debt_stock = pd.DataFrame({'years' : years,'external_debt_stock' : world_external_debt_stock['India'].values, 'label' : ['India'] * num_of_years})
chile_external_debt_stock = pd.DataFrame({'years' : years,'external_debt_stock' : world_external_debt_stock['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_external_debt_stock = pd.DataFrame({'years' : years,'external_debt_stock' : world_external_debt_stock['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_world_external_debt_stock = pd.concat([vietnam_external_debt_stock,china_external_debt_stock,india_external_debt_stock,chile_external_debt_stock,bangladesh_external_debt_stock])
fig_line = px.line(new_world_external_debt_stock, x = 'years', y = 'external_debt_stock', color = 'label')
fig_line.show()
world_forein_direct_invest = pd.read_csv('C:/Users/DUC/Documents/Data/GDP/Foreign direct investment.csv')
world_forein_direct_invest = world_forein_direct_invest.T
columns = world_forein_direct_invest[0:1][:].values
world_forein_direct_invest.columns = columns[0]
world_forein_direct_invest = world_forein_direct_invest[1:]
world_forein_direct_invest.head()
years = [i for i in range(1990,2020)]
num_of_years = 30
vietnam_forein_direct_invest= pd.DataFrame({'years' : years, 'forein_direct_invest' : world_forein_direct_invest['Vietnam'].values, 'label' : ['VietNam'] * num_of_years})
china_forein_direct_invest = pd.DataFrame({'years' : years,'forein_direct_invest' : world_forein_direct_invest['China'].values, 'label' : ['China'] * num_of_years})
india_forein_direct_invest = pd.DataFrame({'years' : years,'forein_direct_invest' : world_forein_direct_invest['India'].values, 'label' : ['India'] * num_of_years})
chile_forein_direct_invest = pd.DataFrame({'years' : years,'forein_direct_invest' : world_forein_direct_invest['Chile'].values, 'label' : ['Chile'] * num_of_years})
bangladesh_forein_direct_invest = pd.DataFrame({'years' : years,'forein_direct_invest' : world_forein_direct_invest['Bangladesh'].values, 'label' : ['Bangladesh'] * num_of_years})
new_world_forein_direct_invest = pd.concat([vietnam_forein_direct_invest,china_forein_direct_invest,india_forein_direct_invest,chile_forein_direct_invest,bangladesh_forein_direct_invest])
fig_line = px.line(new_world_forein_direct_invest, x = 'years', y = 'forein_direct_invest', color = 'label')
fig_line.show()
fig_line = px.line(new_world_stock_marketcap, x = 'years', y = 'stock_marketcap', color = 'label')
fig_line.show()